#pragma once
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>

using namespace std;



class Article
{
private:
	int id;
	string date;
	string title;
	string writer;
	int n;
	string keyword;


public:
	Article(void)
	{
		id = -1;
		date = "";
		title = "";
		writer = "";
		n = -1;
		keyword = "";

	}

	Article(int id, string date, string title, string writer, int n, string keyword)
	{
		this->id = id;
		this->date = date;
		this->title = title;
		this->writer = writer;
		this->n = n;
		this->keyword = keyword;
	}

	void Read()
	{
		string str;

		cout << "id=";
		cin >> id;

		cout << "date=";
		cin >> date;
		getline(cin, str);

		cout << "title=";
		cin >> title;
		getline(cin, str);

		cout << "writer=";
		cin >> writer;
		getline(cin, str);

		cout << "n=";
		cin >> n;
		
		cout << "keyword=";
		cin >> keyword;
	}

	void Write()
	{
		cout << "id=" << id << endl;
		cout << "date=" << date << endl;
		cout << "title=" << title << endl;
		cout << "writer=" << writer << endl;
		cout << "n=" << n << endl;
		cout << "keyword=" << keyword << endl;
	}

	friend ostream & operator<<(ostream &o, const Article &a)
	{
		o << "(";
		o << a.id << ",";
		o << a.date << ",";
		o << a.title << ",";
		o << a.writer << ",";
		o << a.n << ",";
		o << a.keyword;
		o << ")";

		return o;
	}

	friend istream & operator>>(istream &in, Article &a)
	{
		string str;
		getline(in, str, '(');

		in >> a.id;
		getline(in, str, ',');

		getline(in, a.date, ',');
		getline(in, a.title, ',');
		getline(in, a.writer, ',');

		in >> a.n;
		getline(in, str, ',');

		getline(in, a.keyword, ')');

		return in;
	}

	


	~Article(void)
	{
	}

	int GetId() { return id; }
	string GetDate() { return date; }
	string GetTitle() { return title;}
	string GetWriter() { return writer; }
	int Getn() { return n; }
	string GetKeyword() { return keyword; }

	void SetId(int id) { this->id = id; }
	void SetDate(string date) { this->date = date; }
	void SetTitle(string title) { this->title = title; }
	void SetWriter(string writer) { this->writer = writer; }
	void SetN(int n) { this->n = n; }
	void SetKeyword(string keyword) { this->keyword = keyword; }



};

